package cn.kailangtu.dataspot.data.context;

import android.graphics.Color;
import android.widget.TextView;

import cn.kailangtu.dataspot.R;

public class SelectContext {
    private  static TextView selectedView;
    private static int normalColor;
    public static void setSelectedView(TextView newView) {

        if (selectedView != null) {
            if (selectedView.getTag() != null && selectedView.getTag().equals("left")) {
                selectedView.setBackgroundResource(R.drawable.log_go_left);
            } else if (selectedView.getTag() != null && selectedView.getTag().equals("right")) {
                selectedView.setBackgroundResource(R.drawable.log_go_right);
            }
            selectedView.setTextColor(normalColor);
        }

        normalColor = newView.getCurrentTextColor();
        selectedView = newView;
        newView.setTextColor(Color.parseColor("#FF0000"));

        if (selectedView.getTag() != null && selectedView.getTag().equals("left")) {
            selectedView.setBackgroundResource(R.drawable.log_go_left_selected);
        } else if (selectedView.getTag() != null && selectedView.getTag().equals("right")) {
            selectedView.setBackgroundResource(R.drawable.log_go_right_selected);
        }
    }

    public static TextView getSelectedView()
    {
        return selectedView;
    }

}
